package com.mdinfo.gw.door.doorDriver.aopu.request;

import com.mdinfo.base.utils.StringUtil;
import lombok.Data;

import java.util.Date;

/**
 * Created by Administrator on 2018/2/5.
 * 设置门参数
 */
@Data
public class DoorSetParamReq extends BaseReq{

    private Integer opDrTimeLow;
    private Integer opDrTimeHigh;
    private Integer overTime;

    public DoorSetParamReq(Integer mjno,Integer drno,Integer opDrTime,Integer overTime){
        this.setCmd("setDr");
        this.setTrace(StringUtil.getUUid());
        this.setTimeStamp(new Date().getTime());
        this.setMjno(mjno);
        this.setDrno(drno);
        this.setOverTime(overTime);
        if(opDrTime<256){
            this.opDrTimeHigh = 0;
            this.opDrTimeLow = opDrTime;
        }else if(opDrTime<256*256){
            this.opDrTimeHigh = opDrTime/256;
            this.opDrTimeLow = opDrTime%256;
        }else{
            this.opDrTimeLow = 0;
            this.opDrTimeHigh = 0;
        }
    }
}
